-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Safe modules configuration #112
Conversation
54e761d
to
d091af1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be necessary, considering execTransactions
already makes this possible?
src/CPK.ts
Outdated
} | ||
const modules = await this.#contract.call('getModules', []) | ||
const selectedModules = modules.filter( | ||
(mod: Address) => mod.toLowerCase() === moduleAddress.toLocaleLowerCase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An address is a string, so just toLowerCase()
should be fine? I don't think there's a difference though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! It was the VSCode autocomplete. Thank you!
src/CPK.ts
Outdated
const sendOptions = normalizeGasLimit({ ...options, from: ownerAccount }) | ||
const txResult = await this.#contract.send('enableModule', [moduleAddress], { | ||
...sendOptions, | ||
from: ownerAccount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think enableModule
follows the rule for SelfAuthorized
:
require(msg.sender == address(this), "Method can only be called from this contract");
So essentially you would use execTransaction
to call it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm updating this and pushing the tests :)
1a2ef4c
to
363b040
Compare
return await this.#contract.call('getModules', []) | ||
} | ||
|
||
async isModuleEnabled(moduleAddress: Address): Promise<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.2.0 has a contract method for this ;)
Check #89
The following methods won't be added for now until the new CPKFactory contract is available:
cpk.transfer(destination, amountInWei)
execTransactions
:cpk.execTransactions(txs, {value})